package algorythm;
/**
 * 字符串常量池小题
 * */
public class Stringpool {
	public static void main(String[] args) {
		String t1 = new String("hello") + new String("world");
		String t2 = new String("helloworld");					//但是使用new的时候，发生变址
		String t3 = "helloworld";
		String t11 = t1.intern();								//intern，将.左边的对象在字符串常量池中的地址找到
		String t22 = t2.intern();			
		System.out.println(t3 == t1);
		System.out.println(t3 == t2);
		System.out.println(t3 == t11);
		System.out.println(t3 == t22);
	}
}